//http://www.dhtmlgoodies.com/index.html?whichScript=drag_drop_nodes
function activeHeadOfQueue() {
    $('ul.clients_queue li').removeClass('active');
    $('ul.clients_queue li').first().addClass('active');
}
function newClient(){
    if ((queue.count < queue.min) && (IS_MOVING)) {
        var preference = Math.floor((Math.random()*4));
	var time = Math.floor((Math.random()*10000)+1);
	var client = Math.floor((Math.random()*10)+1);
	$(".clients_queue").append('<li class="client client_'+customers[client].id+'" in='+customers[client].interest_in+'><span class="preference">Client for '+ brands[customers[client].interest_in].name +'</span></li>');
        activeHeadOfQueue();
        $('.client_'+client).css('zIndex',customers[client].zIndex);        
        queue.count++;
    }	
    setTimeout(function(){newClient();},time);
}

$('.clients_queue').change(function() {
    console.log('he');
});

$("document").ready(function(e) {
	newClient();
});